package com.sky.controller.user;

import com.sky.Entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("userCategoryController")
@RequestMapping("/user/category")
@Api(tags = "分类相关操作")
public class CategoryController {

    @Autowired
    private CategoryService service;

    @GetMapping("/list")
    public Result<List<Category>> getCategory(@RequestParam(required = false) Integer type){

        List<Category> list=service.pageQuery(type);
        return Result.success(list);

    }
}
